package org.jradweb.core.web;

import java.beans.PropertyDescriptor;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.beanutils.BeanUtilsBean;
import org.jradweb.core.orm.AbstractModel;
import org.jradweb.core.orm.HibernateModel;
import org.jradweb.core.orm.MultiSiteAbstractModel;
public class RequestToBeanMappingUtil {
	private BeanUtilsBean beanUtils=BeanUtilsBean.getInstance();
	public RequestToBeanMappingUtil(){
		super();
	}
	
	public BeanUtilsBean getBeanUtils() {
		return beanUtils;
	}

	public void setBeanUtils(BeanUtilsBean beanUtils) {
		this.beanUtils = beanUtils;
	}

	public void setModelVaules(HibernateModel model,
			HttpServletRequest request) {
		if (AbstractModel.class.isInstance(model)) {
			setAbstractModelValues((AbstractModel) model, request);
		} else if (MultiSiteAbstractModel.class.isInstance(model)) {
			setMultiSiteAbstractModelProperties((MultiSiteAbstractModel) model,
					request);
		}
	}
	
	public  void setAbstractModelValues(AbstractModel model,
			HttpServletRequest request) {
		
	}
	
	public void getProperties(AbstractModel model,HttpServletRequest request){
		PropertyDescriptor[] propDesps= this.beanUtils.getPropertyUtils().getPropertyDescriptors(model);
		request.getParameterMap().keySet();
	}
	
	
	
	private  void setMultiSiteAbstractModelProperties(
			MultiSiteAbstractModel model, HttpServletRequest request) {
		//TODO
	}

}
